class Address < ActiveRecord::Base
  belongs_to :user, :dependent => :destroy
  
  validates_presence_of :street, :streetNr, :city, :zip
  
  #only numbers
  validates_format_of :zip, :with => /\A([0-9]{4,})\Z/i
  validates_format_of :streetNr, :with => /\A([0-9]+([-A-Za-z]?)+)\Z/i
end



# == Schema Information
#
# Table name: addresses
#
#  id         :integer         not null, primary key
#  street     :string(255)
#  streetNr   :string(255)
#  city       :string(255)
#  zip        :string(255)
#  created_at :datetime
#  updated_at :datetime
#  user_id    :integer
#

